/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(initialState: { currentUser?: any }) {
  const { currentUser } = initialState || {};
  return {
    access: function (route: any) {
      return route?.accessList?.some((item: any) => {
        return currentUser?.access?.some((_item: any) => {
          return _item.field === item.field;
        });
      });
    }
    // access:true
  };
}
